Vue.component('m_modal', {
	props:["guide_map"],
	// 选项
	template: '<div>\
				<!--提示框-->\
				<div class="modal my_modal fade" id="more_info"  tabindex="-1" role="dialog">\
					<div class="modal-dialog" style="width:80%;" role="document">\
					    <div class="modal-content">\
						    <div class="modal-header">\
					        	<h4 class="modal-title">{{title}}</h4>\
					      	</div>\
						    <div class="modal-body" v-html="content">\
						    </div>\
						    <div class="modal-footer">\
						        <button type="button" class="btn btn-base" data-toggle="modal" data-target="more_info" data-dismiss="modal">获取更多信息,请先登录</button>\
						    </div>\
					    </div>\
				  	</div>\
				</div>\
				<!--支付提示-->\
				<div class="modal my_modal fade" id="pay"  tabindex="-1" role="dialog">\
					<div class="modal-dialog"  role="document">\
					    <div class="modal-content">\
						    <div class="modal-body text-center"><p style="font-size:20px;"></p>\
						    </div>\
						    <div class="modal-footer my_footer">\
						        <button type="button" class="btn btn-default" data-toggle="modal" data-target="pay" data-dismiss="modal">取消</button>\
						        <button type="button" v-if="globalData.userInfo.IsVip==0" class="btn btn-base wow" data-toggle="modal" data-target="pay" data-dismiss="modal">前往签约WOW</button>\
						        <button type="button" class="btn btn-base" data-toggle="modal" data-target="pay" data-dismiss="modal" @click="pay_product_detail">确认</button>\
						    </div>\
					    </div>\
				  	</div>\
				</div>\
				<!--引导图-->\
				<div class="modal my_modal" id="modal_photos" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">\
					<div class="modal-dialog modal-lg" style="top: 50%;" role="document">\
						<div class="modal-body">\
							<div class="swiper-container text-center" style="\'max-width\':500px;">\
								<div class="swiper-wrapper" >\
									<div class="swiper-slide" v-for="item in guide_map">\
										<div style="position:relative;height:100%;display:inline-block;">\
											<img style="height:100%;" v-bind:src="item.ImgUrl | add_baseUrl"  alt="" />\
											<img src="imgs/high_life/del.png" class="close" data-dismiss="modal" style="position: absolute;right: 12px;top: 12px;width:30px;height:30px;opacity:.8;" alt="" />\
										</div>\
									</div>\
								</div>\
								<!-- 如果需要分页器 -->\
								<div class="swiper-pagination"></div>\
								<!-- 如果需要导航按钮 -->\
							</div>\
						</div>\
					</div>\
				</div>\
			<div>',
	data: function() {
		return {
			url: {
				getRequirementAnalysisImgs:'/api/Banner/GetRequirementAnalysisImgs', //引导图
			},
			title:"",
			content:""
		}
	},
	mounted: function(){
		$(document).on('click',".wow",function(){
			globalData.utils.setUrl("my_center.html",{type:5})
			
		})
	},
	methods: {
		more_info_show:function(title,content){
			this.title = title
			this.content = content
			$("#more_info").modal()
		},
		pay_product_detail:function(){
			//获取价格
			var price = 0
			globalData.ajaxPost("/api/Product/GetProductPrices",{'ModelID':globalData.getStorage('modelID')}, function(res) {
				console.log(res)					
				price = res.data[0].Price	
				//付钱
				var product_item = globalData.getStorage("product_item")
				console.log(product_item)
				var data = {
					    'CargoName': product_item.ProductName,
					    'CargoNo': product_item.ProductNo,
					    'CargoCount': '1',
					    'Money': price,
					    'Remark': '产品PPT支付|'+ product_item.ID +'|',
					    'OrderType': '6'
				}
				globalData.ajaxPost("/api/Order/GenOrder",data, function(res) {
					console.log(res)
					$("#alert").modal()
					$("#alert p").text(res.data.MsgContent)
					$("#alert button").one("click",function(){
						window.location.reload()
					})				
				})
			})
		},
		get_requirement_analysis_imgs:function(){ //引导图
			var that = this;
			globalData.ajaxPost(this.url.getRequirementAnalysisImgs, null, function(res) {
				console.log(res)
				if(res.suc) {					
					console.log(res.data)
					that.guide_map = res.data
					$("#modal_photos").modal()
					setTimeout(function(){
						var mySwiper = new Swiper('#modal_photos .swiper-container', {
							loop: true,
							// 如果需要分页器
							pagination: '#modal_photos .swiper-pagination',
							freeMode:false,
							initialSlide:0,
							speed:10,
							autoplay:3000,
							autoplayDisableOnInteraction : false,
							// 如果需要前进后退按钮
//							nextButton: '#modal_photos .swiper-button-next',
//							prevButton: '#modal_photos .swiper-button-prev'
						})
					},100)
				}
			})
		},
	}
});
function go_product_introduct(item){
		globalData.setStorage('product_detail', item)
		globalData.utils.setUrl("product_intro.html", null, true)
//	if(item.IsNotFree && !item.IsPayed){				
//		var data = {
//			'ModelID':globalData.getStorage('modelID'),
//			'ConfigKey':'Tip_VisitProductPowerPointBeforeVip'
//		}
//		globalData.ajaxPost("/api/AppFun/GetTips", data, function(res) {
//			console.log(res)
//			$('#pay p').text(res.data)
//			$('#pay').modal()		
//			globalData.setStorage('product_item',item)
//		})				
//	} else {
//		globalData.setStorage('product_detail', item)
//		globalData.utils.setUrl("product_intro.html", null, true)
//	}

}

Vue.component('types', {
	props: ['type'],
	// 选项
	template: '<div class="nine_type">\
					<li  v-for=\'(item,index) in modelList\' v-if="item.ShowHome==true" @click=\'viewModelDetail(item.ID,item.ModelShortName,index)\' v-bind:class="[{active:type==index}]"><span class="cursor">{{item.ModelName}}</span></li>\
				</div>',
	data: function() {
		return {
			type:this.type,
			modelList:[],	//模块列表
		}
	},
	mounted: function(){
		//获取模块分类
		this.getSubModel()
	},
	methods:{
		//获取子模块信息 
		getSubModel:function(){
			var self = this;
			var url = globalData.constParam.url.index_GetSubModels;
			var data={ModelID:"73843dd0457c478481d988856b4cce69"};
			globalData.ajaxPost(url,data,function(res){
				if(res.suc){
					self.modelList=res.data;
				}else{
					alert(res.msg);
				}
			})
		}, 
		viewModelDetail: function(modelID,modelshortName,index) {		
			//智能分析需要登录
			if(modelID == 11){
				if(!globalData.userIsLogin(null,true)){
					return;
				}	
			}
			globalData.setStorage('modelID',modelID);
			globalData.setStorage('modelShortName',modelshortName);
			switch (Number(modelID))
			{
				case 3:
					globalData.utils.setUrl('hight_life.html')
					break;
				case 4:
					globalData.utils.setUrl('overseas_policy.html')
					break;
				case 5:
					globalData.utils.setUrl('International_planning.html')
					break;
				case 6:
					globalData.utils.setUrl('overseas_property.html')
					break;
				case 7:
					globalData.utils.setUrl('overseas_trust.html')
					break;
				case 8:
					globalData.utils.setUrl('tax_planning.html')
					break;
				case 9:
					globalData.utils.setUrl('financial_investment.html')
					break;
				case 10:
					globalData.utils.setUrl('special_solution.html')
					break;
				case 11:									
					globalData.utils.setUrl('intelligent_analysis.html') 
					break;
			}
			
		}
	}
});